package net.csdn.business.common.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import net.csdn.business.common.constant.CommonConstants;
import net.csdn.business.common.domain.issue.IssueExt;
import net.csdn.business.common.domain.vo.user.UserInfoVO;
import net.csdn.business.common.utils.JsonUtil;
import org.apache.commons.lang3.ObjectUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;


/**
 * @ClassName: IssueItemVO
 * @Description:
 * @Author: zhangyl
 * @Date: 2024/8/14 16:53
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class IssueItemVO implements Serializable
{
    /** issueID； */
    //@JsonProperty(value = "id")
    private String id;

    /** 仓库ID； */
    private String projectId;

    /** 创建人id； */
    private String uid;

    /** 创建人id； */
    private Integer uType;

    /** serialNumber */
    // @JsonProperty(value = "serial_number")
    private Integer serialNumber;

    /** 标题 */
    // @JsonProperty(value = "title")
    private String title;

    /** issue的lock状态 */
    private Integer lock;

    /** issue开启或关闭状态 */
    private Integer status;

    /**
     * issue优先级 {@link net.csdn.business.common.enums.IssueEnum.PriorityEnum}
     */
    private Integer priority=0;

    private String description;

    /** 内容 */
    // @JsonProperty(value = "content")
    private String content;

    /** mdContent */
    //@JsonProperty(value = "md_content")
    private String mdContent;

    @JsonFormat(pattern = CommonConstants.DEFAULT_PATTERN, timezone = CommonConstants.DEFAULT_TIMEZONE)
    private Date createdDate;

    @JsonFormat(pattern = CommonConstants.DEFAULT_PATTERN, timezone = CommonConstants.DEFAULT_TIMEZONE)
    private Date updatedDate;

    @JsonFormat(pattern = CommonConstants.DEFAULT_PATTERN, timezone = CommonConstants.DEFAULT_TIMEZONE)
    private Date closedDate;

    private String targetUrl;

    private String nameWithNamespace;

    private String pathWithNamespace;

    /** 负责人id */
    private String assignUser;

    private UserInfoVO creatorInfo;

    private UserInfoVO assignUserInfo;

    private Integer commentTotal=0;

    private List<LabelVo> labels;

    private String milepostId;
    private MilepostVo milepost;

    private String ext;


    public IssueExt fetchExt() {
        if (ObjectUtils.isEmpty(this.ext)) {
            return new IssueExt();
        }
        return JsonUtil.toBean(this.ext, IssueExt.class);
    }

}
